package com.wcs.exam.controller.auth;

import com.wcs.exam.common.base.Result;
import com.wcs.exam.controller.biz.UploadCommonBiz;
import com.wcs.exam.controller.biz.resp.UploadPicResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 上传接口
 *
 * @author wcs
 */
@Tag(name = "auth-上传相关接口")
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/v1/auth/upload")
public class AuthUploadController {

    @NotNull
    private final UploadCommonBiz biz;

    @Operation(summary = "服务端上传图片接口，只支持图片格式")
    @PostMapping(value = "/pic")
    public Result<UploadPicResp> uploadPic(@RequestParam(value = "picFile", required = false) MultipartFile picFile) {
        return biz.uploadPic(picFile);
    }

}
